home *** CD-ROM | disk | FTP | other *** search
- /*
- File: CAS_Doc.h
-
- Contains: Constants and public function prototypes for CAS_doc.c
-
- Written by: David H Nelson
-
- Copyright © 1993-1995 ComponentWorks, All rights reserved.
-
- Change History (most recent first):
-
- <5> 06/07/95 RB Adding frameRef fields to the Doc structure
- Modifing fileHeader to include embedded frame count
- <4> 04/22/95 DAS removed #include "CALib.h"
- <4> 03/27/95 DAS changed Doc_HasDirty() to Doc_SetDirty()
- <3> 03/16/95 RB Added storageModel field to DocRecord. Also
- added kContainerFileType define.
- <2> 01/17/95 DAS added Win_IsToolWindow() prototype
- <1> 11/20/93 DHN Created.
- */
-
- #if !defined(_H_CAS_Doc)
- #define _H_CAS_Doc
-
- #include "CAS_Types.h"
-
- #include <Printing.h>
-
- #ifdef USE_CALIB
- #include "CALib.h"
- #endif
-
- //---------------------------------------------------------------------------
- #define kOurFileType 'cafl'
- #define kOurFileCreator 'casm'
-
- #ifdef USE_CALIB
- #define CALIB_SAVVY_DATA_TRANSFER 1
- #define kContainerFileType 'cabf'
- #define kCASampleKind "ComponentWorks:Kind:CASample"
- #endif
-
- #define MAXITEMCOUNT 100
- #define MAXPICTCOUNT 20
-
- // These are the "globals" for each window.
- struct DocRecord
- {
- FSSpec fileSpec; // if any
- short fileRefNum; // refnum of our file.
- Boolean fileLocked; // true if our file is locked.
- Boolean filler1;
-
- Boolean changed; // true if our doc has been changed
-
- THPrint hPrint; // print setup record.
-
- ControlHandle hScrollBar; // horiz scroll bar.
- ControlHandle vScrollBar; // vert scroll bar.
-
- Rect hScrollBarRect; // rect of horiz scroll bar.
- Rect vScrollBarRect; // rect of vert scroll bar.
-
- Rect contentRect; // content area of window.
- Rect documentRect; // total page area of doc.
-
- Handle undoData; // the previous state of the doc.
-
- ElemCollPtr contentColl;
- Point insertionPoint;
-
- #ifdef USE_CALIB
- CADocumentRef partDocRef;
- short storageModel; // kNativeStorageModel or kBentoStorageModel
- #endif
-
- };
-
- // This is our file format, followed by an array of itemCount itemRecords
- typedef struct
- {
- // if you change this, better change kFileVersion below. Set it back to 1 for a final release.
- short version;
-
- TPrint printRecord; //
- Rect windowRect; //
- Rect documentRect; //
- short hScrollValue; //
- short vScrollValue; //
- Point insertionPoint; //
- long elemCount;
-
- }
- fileHeader;
-
- #ifdef USE_CALIB
- #define kFileVersion 7
- #else
- #define kFileVersion 4
- #endif
-
- // Internal scrap format
- // Both scrap copies and drags pass both kCASScrapType
- // and kPICTType data.
- //
-
- #define kCASScrapType 'CASS'
-
- #ifdef USE_CALIB
- #define kCACASScrapType 'CCAS'
- #define kCACASScrapTypeStr "CCAS"
- #define kCACASScrapTypeISO "Apple:OSType:Scrap:CCAS" // The "Apple:OSType:Scrap:" prefix is required
- #endif
-
- //---------------------------------------------------------------------------
- #if defined(__cplusplus)
- extern "C"
- {
- #endif
-
-
- void Doc_InitData( DocPtr theDoc );
- OSErr Doc_WriteFile( DocPtr theDoc );
- OSErr Doc_ReadFile( DocPtr theDoc );
-
- // Scrap methods
- Handle Doc_CreateScrapFromSelection( DocPtr theDoc );
- void Doc_AddItemsFromScrap( DocPtr theDoc, Handle theScrap, Point origin );
-
- // Document methods
- Boolean Doc_GetDirty( DocPtr theDoc );
- void Doc_SetDirty( DocPtr theDoc, Boolean isDirty );
- OSErr Doc_SaveAs( DocPtr theDoc );
- OSErr Doc_Save( DocPtr theDoc );
- OSErr Doc_New( void );
- void Doc_Close( DocPtr theDoc );
- OSErr Doc_Open( FSSpec* theSpec );
- void Doc_SaveUndo( DocPtr theDoc );
- void Doc_RestoreUndo( DocPtr theDoc );
- void Doc_DisposeUndo( DocPtr theDoc );
- WindowPtr Doc_GetWindow( DocPtr theDoc );
- void Doc_Draw( DocPtr theDoc );
-
- // Item routines
- ElemPtr Doc_AddItemPict( DocPtr theDoc, PicHandle thePict, Point thePt );
- Boolean Doc_SelectionExists( DocPtr theDoc );
- void Doc_SelectAllElements( DocPtr theDoc, Boolean bSelect );
- void Doc_CalcContentElemRgn( DocPtr theDoc, RgnHandle theRgn );
- short Doc_GetSelectedFrameCount( DocPtr theDoc);
-
- // Selection routines
- void Doc_DeleteElements( DocPtr theDoc, ElemListPtr selectionList );
- void Doc_DeleteCurrentSelection( DocPtr theDoc );
- void Doc_MoveSelection( DocPtr theDoc, short offsetH, short offsetV );
- void Doc_CalcSelectionBounds( DocPtr theDoc, Rect *boundsRect );
- void Doc_CalcContentBounds( DocPtr theDoc, Rect *boundsRect );
- void Doc_CalcSelectionRgn( DocPtr theDoc, RgnHandle theRgn );
- PicHandle Doc_CreateSelectionPicture( DocPtr theDoc );
-
- // Edit Menu Items
- void Doc_UndoMenu( DocPtr theDoc );
- void Doc_CutMenu( DocPtr theDoc );
- void Doc_CopyMenu( DocPtr theDoc, Boolean isCut );
- void Doc_PasteMenu( DocPtr theDoc );
- void Doc_ClearMenu( DocPtr theDoc );
- void Doc_SelectAllMenu( DocPtr theDoc );
-
- // Graphics routines
- void Doc_RectDocToGlobal( DocPtr theDoc, Rect* theRec );
- void Doc_RgnDocToGlobal( DocPtr theDoc, RgnHandle theRgn );
- void Doc_SetGrafOrigin( DocPtr theDoc );
-
- void Doc_HandleSelectionRect( DocPtr theDoc, Point startPt);
-
- // CALib Version specific routines
-
- #ifdef USE_CALIB
-
-
- ElemPtr Doc_AddEmbeddedFrame( DocPtr theDoc, CAFrameRef frameRef, Point location);
- ElemPtr Doc_FindElemForFrameRef( DocPtr theDoc, CAFrameRef frameRef);
-
-
- Handle Doc_CreateCAScrapFromSelection( DocPtr theDoc,
- CADocumentRef transferDoc,
- CACloneKind cloneKind);
-
- void Doc_AddItemsFromCAScrap( DocPtr theDoc,
- Handle theScrap,
- Point* origin,
- CADocumentRef transferDoc,
- CACloneKind cloneKind);
-
- #endif
-
- #if defined(__cplusplus)
- }
- #endif
-
-
- #endif
-
-